home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / network / admin / dig-2.0 / dig-2 / dig.2.0 / netdb.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-09-01  |  2.4 KB  |  75 lines

  1. /*
  2.  * Copyright (c) 1980,1983,1988 Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms are permitted
  6.  * provided that this notice is preserved and that due credit is given
  7.  * to the University of California at Berkeley. The name of the University
  8.  * may not be used to endorse or promote products derived from this
  9.  * software without specific prior written permission. This software
  10.  * is provided ``as is'' without express or implied warranty.
  11.  *
  12.  *    @(#)netdb.h    5.9 (Berkeley) 4/5/88
  13.  */
  14.  
  15. /*
  16. ** Distributed with 'dig' version 2.0 from University of Southern
  17. ** California Information Sciences Institute (USC-ISI). 9/1/90
  18. */
  19.  
  20. /*
  21.  * Structures returned by network
  22.  * data base library.  All addresses
  23.  * are supplied in host order, and
  24.  * returned in network order (suitable
  25.  * for use in system calls).
  26.  */
  27. struct    hostent {
  28.     char    *h_name;    /* official name of host */
  29.     char    **h_aliases;    /* alias list */
  30.     int    h_addrtype;    /* host address type */
  31.     int    h_length;    /* length of address */
  32.     char    **h_addr_list;    /* list of addresses from name server */
  33. #define    h_addr    h_addr_list[0]    /* address, for backward compatiblity */
  34. };
  35.  
  36. /*
  37.  * Assumption here is that a network number
  38.  * fits in 32 bits -- probably a poor one.
  39.  */
  40. struct    netent {
  41.     char        *n_name;    /* official name of net */
  42.     char        **n_aliases;    /* alias list */
  43.     int        n_addrtype;    /* net address type */
  44.     unsigned long    n_net;        /* network # */
  45. };
  46.  
  47. struct    servent {
  48.     char    *s_name;    /* official service name */
  49.     char    **s_aliases;    /* alias list */
  50.     int    s_port;        /* port # */
  51.     char    *s_proto;    /* protocol to use */
  52. };
  53.  
  54. struct    protoent {
  55.     char    *p_name;    /* official protocol name */
  56.     char    **p_aliases;    /* alias list */
  57.     int    p_proto;    /* protocol # */
  58. };
  59.  
  60. struct hostent    *gethostbyname(), *gethostbyaddr(), *gethostent();
  61. struct netent    *getnetbyname(), *getnetbyaddr(), *getnetent();
  62. struct servent    *getservbyname(), *getservbyport(), *getservent();
  63. struct protoent    *getprotobyname(), *getprotobynumber(), *getprotoent();
  64.  
  65. /*
  66.  * Error return codes from gethostbyname() and gethostbyaddr()
  67.  * (left in extern int h_errno).
  68.  */
  69.  
  70. #define    HOST_NOT_FOUND    1 /* Authoritative Answer Host not found */
  71. #define    TRY_AGAIN    2 /* Non-Authoritive Host not found, or SERVERFAIL */
  72. #define    NO_RECOVERY    3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
  73. #define    NO_DATA        4 /* Valid name, no data record of requested type */
  74. #define    NO_ADDRESS    NO_DATA        /* no address, look for MX record */
  75.